package ar.com.sgsvm.common;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class Preferences {

	private static final String NAME_PREFERENCES = "myPrefs";
	
	private Context mContext;
	private SharedPreferences mSharedPreferences;
	private static final String ORDENAR_CLIENTE = "criterioOrdenCliente";
	private static final String ASCENDENTE_CLIENTE = "ascendenteCliente";
	
	public Preferences(Context context){
		mContext = context;
		mSharedPreferences = mContext.getSharedPreferences(NAME_PREFERENCES, Context.MODE_PRIVATE);
	}
	
	public void setCriterioOrdenCliente(int criterio){
		Editor editor = mSharedPreferences.edit();
		editor.putInt(ORDENAR_CLIENTE, criterio);
		editor.commit();
	}
	
	public int getCriterioOrdenCliente(){
		return mSharedPreferences.getInt(ORDENAR_CLIENTE, 0);
	}
	
	public void setAscendenteCliente(int asc){
		Editor editor = mSharedPreferences.edit();
		editor.putInt(ASCENDENTE_CLIENTE, asc);
		editor.commit();
	}
	
	public int getAscendenteCliente(){
		return mSharedPreferences.getInt(ASCENDENTE_CLIENTE, 1);
	}
	
}
